ggplot2

library(ggplot2)
library(reshape2)
library(plotly)
## 
## Attaching package: 'plotly'
## The following object is masked from 'package:ggplot2':
## 
##     last_plot
## The following object is masked from 'package:stats':
## 
##     filter
## The following object is masked from 'package:graphics':
## 
##     layout
collectionMat = read.csv(file = "../SingleCollectionUnequalProb_3params.csv", header = FALSE)
collectionMat = as.matrix(collectionMat)
dim(collectionMat)
## [1] 100 100
collectionMat = ifelse(collectionMat > 0, collectionMat, 0)

pXY = seq(0.001, 0.999, by = 0.01)

colnames(collectionMat) = rownames(collectionMat) = pXY

plotdf = melt(collectionMat)
plotdf %>% head
##    Var1  Var2    value
## 1 0.001 0.001 1500.000
## 2 0.011 0.001 1007.576
## 3 0.021 0.001 1002.165
## 4 0.031 0.001 1001.008
## 5 0.041 0.001 1000.581
## 6 0.051 0.001 1000.377
ggplot(data = plotdf) +
  geom_tile(aes(x = Var1, y = Var2, fill = value)) +
  scale_fill_distiller(palette = "YlGnBu", trans = "log10", direction = "-1") + 
  theme_bw()

ggplot(data = plotdf) +
  geom_contour(aes(x = Var1, y = Var2, 
                   z = value, colour = ..level..), bins = 200, size = 1.2) + 
  scale_colour_distiller(palette = "Reds", trans = "log10", direction = "1") + 
  theme_bw()

plotly

colnames(collectionMat) = rownames(collectionMat) = NULL
plot_ly(x = pXY, y = pXY, z = ~collectionMat) %>% 
  add_surface(colorscale='Jet')

d3heatmap

library(d3heatmap)
d3Data = log10(collectionMat + 1)
colnames(d3Data) = rownames(d3Data) = pXY
d3heatmap(d3Data, Colv = F, Rowv = F, colors = "YlGnBu")